<?php
namespace Logistics\Model;

use Common\Model\CommonModel;

class CarModel extends CommonModel {

    protected $softdelete = false;
    protected $deleteTime = 'delete_time';

    public function get_list($where = array(),$order = '',$from =  0,$to = 0){
        $list = M("Car")->alias("c")->field("c.*,l.logistics_name,d.driver_name,ca.number AS card_number,ca.balance,ca.point")->where($where)
            ->join("bdt_logistics l ON l.id = c.lid","LEFT")
            ->join("bdt_driver d ON d.id = c.driver_id","LEFT")
            ->join("bdt_card ca ON ca.id = c.card_id","LEFT")
            ->order($order)
            ->limit($from , $to)
            ->select();
        return $list;
    }

//    /**
//     * 根据会员卡号获取会员卡信息
//     */
//    public function get_card_one($where){
//        $card = M("Car")->alias("c")->field("c.*,l.logistics_name,d.driver_name,ca.number AS card_number,ca.car_code,ca.balance,ca.point")->where($where)
//            ->join("bdt_logistics l ON l.id = c.lid")
//            ->join("bdt_driver d ON d.id = c.driver_id")
//            ->join("bdt_card ca ON ca.id = c.card_id")
//            ->find();
//        return $card;
//    }


}